//
//  MYXReleasePhotoViewCell.m
//  meiyinxiang
//
//  Created by 陈李飞 on 2017/11/28.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "MYXReleasePhotoViewCell.h"
#import "MYXmypublishModel.h"
@implementation MYXReleasePhotoViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)setMYXmypublishMo:(MYXmypublishModel *)MYXmypublishMo{
    _MYXmypublishMo = MYXmypublishMo;
    NSArray *urlArray = [MYXmypublishMo.file componentsSeparatedByString:@","];
    NSString *imgurl = urlArray[0];
    if (MYXmypublishMo.file) {
        [self.IconImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MYXIMGBaseUrl,imgurl]] placeholderImage:[UIImage imageNamed:@"defual_luckyImg"]];
        self.IconImageView.contentMode  = UIViewContentModeScaleAspectFill;
        self.IconImageView.layer.masksToBounds = YES;
    }else{
        self.IconImageView.image =[UIImage imageNamed:@"AppIcon"];
    }
    self.titileLabel.text=MYXmypublishMo.content;
    NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:self.titileLabel.text];
    NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle1 setLineSpacing:8];
    [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [self.titileLabel.text length])];
    [self.titileLabel setAttributedText:attributedString1];
    [self.titileLabel sizeToFit];
  
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:MYXmypublishMo.create_time.integerValue];

    NSString *timeStr= [MYXDateTimeHelper prettyDateWithRefe:date];
    if ([timeStr isEqualToString:@"今天"]||[timeStr isEqualToString:@"昨天"]) {
        self.numLabel.text = timeStr;
        self.YueLabel.hidden = YES;
    }else{
        self.numLabel.text = [timeStr componentsSeparatedByString:@"月"][0];
        self.YueLabel.hidden = NO;
    }

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
